<?php
/**
 * Translation Memory Research Software
 * 
 * @author	Joseph Chereshnovsky <joseph.chereshnovsky@gmail.com>
 * @version	1.0
 */
$include_path = get_include_path();
$paths = explode(PATH_SEPARATOR, $include_path);

// Server autoconfiguration
if ('trc.localhost' == $_SERVER['SERVER_NAME']) {

	/**
	 * Server application mode
	 */
	define('SERVER_ENV', 'development');
	define('APPLICATION_MODE', 'production');

	/**
	 * Define main directories
	 */
	define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/'));
	define('APPLICATION_CACHE_DIR', realpath(APPLICATION_PATH . '/../tmp'));

	unset($paths[0]);
	$paths[] = realpath(APPLICATION_PATH . '/../library');

	/**
	 * Set application URL
	 */
	define('APP_URL', '');
	
} elseif ('www.l10nex.org.ua' === $_SERVER['SERVER_NAME'] || 'l10nex.org.ua' === $_SERVER['SERVER_NAME']) {
	
	/**
	 * Server application mode
	 */
	define('SERVER_ENV', 'production');
	define('APPLICATION_MODE', 'production');

	/**
	 * Define main directories
	 */
	define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application/'));
	define('APPLICATION_CACHE_DIR', realpath(APPLICATION_PATH . '/../tmp'));
	
	unset($paths);
	$paths[] = realpath(APPLICATION_PATH . '/../library');

	/**
	 * Set application URL
	 */
	define('APP_URL', '');

} elseif ('wise-engineering.com' === $_SERVER['SERVER_NAME']){

	/**
	 * Server application mode
	 */
	define('SERVER_ENV', 'demo');
	define('APPLICATION_MODE', 'development');

	/**
	 * Define main directories
	 */
	define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application/'));
	define('APPLICATION_CACHE_DIR', realpath(APPLICATION_PATH . '/../tmp'));
	
	unset($paths[0]);
	unset($paths[1]);
	unset($paths[2]);
	$paths[] = realpath(APPLICATION_PATH . '/../library');
	
	/**
	 * Set application URL
	 */
	define('APP_URL', 'http://wise-engineering.com/demo/zend_example');
}

// extend include path
set_include_path(implode(PATH_SEPARATOR, $paths));
unset($paths);

/**
 * Bootstrap application
 */
require_once APPLICATION_PATH . '/bootstrap.php';